<?php

//debug:
//$ts = new TestService();
//$ts->testMysqlQuery("");

include_once("../../php/db/config.php");

class AppendProfile { 
	var $dbhost = HOSTNAME;
	var $dbname = DATABASE;
	var $dbuser = USERNAME;
	var $dbpass = PASSWORD;

	function AppendProfile()
	    {
	    $this->methodTable = array(
		"appendQuery" => array(
		    "description"    => "TAppend new Profile",
		    "access"    => "remote",
		    "arguments" => array(arg1, arg2, arg3, arg4, arg5, arg6, arg7),
		    "returntype"=> "int"
		)
	    );
	    // Initialize db connection

            $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
            mysql_select_db ($this->dbname);
	    }
	
	public function appendQuery($username, $password, $age, $gender, $type, $lang, $email) {
		 
		//$z = mysql_query($query);
		//return ($z);
		//include '../../php/db/config.php';
		//include '../../php/db/open_db.php';

		// debug:
		//$query = "SELECT * FROM profile WHERE UserStatus='offline'";
		$query = "INSERT INTO $dbtable (UserName, UserPass, UserAge, UserGender, UserType,Language, email) VALUES ('$username', PASSWORD('$password'), '$age', '$gender', '$type', '$lang', '$email')";
		//$query = "INSERT INTO profile VALUES('',$arg1,$arg2 ,$arg3,$arg4 ,1,3,$arg5,'')";
		//if($result = $mysqli->query($query))
		//    {
		//    $row = $result->fetch_object();
		//    //echo $row->UserName;
		//    include '../../php/db/close_db.php';
		//    return ($row->UserName);
		//    }
		return mysql_query($query);
	}
	
}
?>
